package com.webdesign.dto;

import java.util.Date;

/*
 * 某个作业的完成情况，区别于tbhomework的是包括已完成人数以及未完成人数
 */
public class HomeworkInfoDTO{
	private String homeworkid;
	
	private String title;
	
	private String description;
	
	private Byte graded;
	
	private String termid;
	
	private Byte state;
	
	private Date starttime;
	
	private Date endtime;
	
	private Date createtime;
	
	private int submitnum;
	
	private int unsubmitnum;

	public String getHomeworkid() {
		return homeworkid;
	}

	public void setHomeworkid(String homeworkid) {
		this.homeworkid = homeworkid;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Byte getGraded() {
		return graded;
	}

	public void setGraded(Byte graded) {
		this.graded = graded;
	}

	public String getTermid() {
		return termid;
	}

	public void setTermid(String termid) {
		this.termid = termid;
	}

	public Byte getState() {
		return state;
	}

	public void setState() {
		Date nowtime = new Date();
		if(nowtime.compareTo(this.endtime) < 0 && nowtime.compareTo(this.starttime) > 0){
			this.state = 1;
		}else if(nowtime.compareTo(this.endtime) >= 0){
			this.state = 2;
		}else if(nowtime.compareTo(this.starttime) <= 0){
			this.state = 0;
		}
	}
	
	public Date getStarttime() {
		return starttime;
	}

	public void setStarttime(Date starttime) {
		this.starttime = starttime;
	}

	public Date getEndtime() {
		return endtime;
	}

	public void setEndtime(Date endtime) {
		this.endtime = endtime;
	}

	public Date getCreatetime() {
		return createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}

	public int getSubmitnum() {
		return submitnum;
	}

	public void setSubmitnum(int submitnum) {
		this.submitnum = submitnum;
	}

	public int getUnsubmitnum() {
		return unsubmitnum;
	}

	public void setUnsubmitnum(int unsubmitnum) {
		this.unsubmitnum = unsubmitnum;
	}
	
	
}
